<template>
	<view class="container">
		<view class="wrap">
			<view class="ktx">
				可提现佣金 <text class="redwz">{{userCenterData.user.allYjScore+userCenterData.user.useYjScore}}元</text>
			</view>
			<view class="input">
				<uni-easyinput v-model="money" placeholder="请输入本次提现金额" />
			</view>
			<view v-if="typeId==2">
				<view class="redwz" style="font-size: 28rpx;">
					点击确认提现后，即表示您同意“温邻圈结算规则”
				</view>

				<view class="ktx">
					<view class="sjgz" style="color: #333333;">
						{{article.title}}：
					</view>
					<rich-text class="sjgz-line" :nodes="article.content"></rich-text>
					<!-- <view class="sjgz-line">
						1、提现金额以T+1的模式到账；
					</view>
					<view class="sjgz-line">
						2、温邻圈平台给商家以核销金额60%的基数结算，且需缴纳结算金额10%的手续费；
					</view>
					<view class="sjgz-line">
						3、确认提现后会进入审核状态，审核通过后才会到账，请注意查看审核结果。
					</view> -->
				</view>
			</view>
			<view v-else>
				<rich-text class="sjgz-line" :nodes="article.content"></rich-text>
				<!-- <view class="ktx">
					提现佣金申请提交后，平台将在3个工作日之内结算，审核通过，佣金自动提现到微信零钱，请注意查收！
				</view>
				<view class="redwz">
					温馨提示：佣金需满100元才可申请提现
				</view> -->
			</view>

		</view>
		<view class="btn-div">
			<view class="btncss" @click="addWithdrawal">
				确定
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				money: "",
				userCenterData: {
					user: {

					}
				},
				typeId: 1,
				articleId: 66,
				article: {}
			};
		},
		onLoad(options) {
			if (options.typeId)
				this.typeId = options.typeId
			if (this.typeId == 2) {
				this.articleId = 65
			}
		},
		onShow() {
			this.getUserInfo()
			this.getArticleDetail()
		},
		methods: {
			async getUserInfo() {
				this.$public.htmlPost("/api/getUserInfo").then((res) => {
					let data = res.data
					if (data.code == 0) {
						this.userCenterData.user = data.data
					}
				})
			},
			addWithdrawal() {
				let that = this
				this.$public.htmlPost("/api/addWithdrawal", {
					integral: this.money
				}).then((res) => {
					let data = res.data
					if (data.code == 0) {
						uni.showModal({
							title: "温馨提示",
							content: "您的体现申请已提交，请等待管理员审核",
							showCancel: false,
							success: function() {
								that.$public.switchTabTo("index")

							}
						})
					}
				})
			},
			getArticleDetail() {
				let that = this
				this.$public.htmlPost("/api/getArticleDetail", {
					articleId: that.articleId
				}).then((res) => {
					console.log("getArticleDetail res", res)
					let data = res.data;
					if (data.code == 0) {
						that.article = data.data
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.wrap {
		padding: 30rpx;

		.ktx {
			color: #666666;
			font-size: 28rpx;
			margin-bottom: 30rpx;
		}

		.input {
			margin-bottom: 30rpx;
		}

		.redwz {
			color: #DF686A;
		}


	}

	.btn-div {
		position: fixed;
		bottom: 20rpx;
		width: 90%;
		left: 5%;

		// padding: 0 30rpx;
	}

	.sjgz {
		margin-top: 40rpx;
	}

	.sjgz-line {
		margin-top: 24rpx;
		line-height: 1.8;
	}
</style>